<meta args="config"/>
<form s="nda,datac,valid" s-data="config" id="form">
    <table class="table table-striped table-bordered">
        <tr>
            <td style="width: 100px;">商品Id列表</td>
            <td>
                <input autocomplete="off" type="text" name="skuIds" class="form-control"/>
                <div class="help-block">多个商品id用逗号隔开</div>
            </td>
        </tr>
        <tr>
            <td style="width: 100px;">三级类目id</td>
            <td>
                <div class="input-group input-group-sm">
                    <a href="javascript:;" class="input-group-addon" name="cid3Name" id="jdCatName">-</a>
                    <input autocomplete="off" type="text" name="cid3" class="form-control jdCatId input-sm" placeholder="">
                    <input autocomplete="off" type="hidden" name="cid3Name" id="jdCatNameInput"/>
                    <a href="javascript:;" class="input-group-addon" s-click="selectJdGoodsCategory(this)">选择</a>
                </div>
            </td>
        </tr>
        <tr>
            <td style="width: 100px;">关键字</td>
            <td>
                <input autocomplete="off" type="text" name="goodsKeyword" class="form-control"/>
            </td>
        </tr>
        <tr>
            <td style="width: 100px;">价格区间</td>
            <td class="form-inline">
                <input autocomplete="off" type="text" name="priceFrom" s-valid-error="number()" class="form-control"/> -
                <input autocomplete="off" type="text" name="priceTo" s-valid-error="number()"  class="form-control"/>
            </td>
        </tr>
    </table>
</form>

<script>
    S.getConfig = function () {
        var deferred = $.Deferred();
        $form.validate().done(function() {
            deferred.resolve(Smart.serializeToObject($form.node))
        })
        return deferred;
    }
    function selectJdGoodsCategory($this) {
        S.popupOpen("/jos/goodsCategorySelector.html").done(function(cats) {
            if(cats && cats.length) {
                var cat = cats[0]
                $this.node.parent().find(".jdCatId").val(cat.id);
                $jdCatName.node.html(cat.name)
                $jdCatNameInput.node.val(cat.name)
            }
        })
    }
</script>